package cf;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Example01 {

	public static void main(String[] args) {
		
		List<String> stringList = new ArrayList<String>();

		stringList.add("Ciao");
		stringList.add("Mondo");
		stringList.add("Casa");
		stringList.add("Martinelli");
		
		
		System.out.println("Primo caso:");
		Iterator<String> iterator = stringList.iterator();
		while(iterator.hasNext()){
			String string= iterator.next();
			System.out.println(string);			
		}
		
		System.out.println("Secondo caso:");	// per ogni stringa string presente in stringList
		for (String string : stringList) {
			System.out.println(string);	
		}
		
		
		System.out.println("Terzo caso:");	
		for (int i = 0; i < stringList.size(); i++) {
			System.out.println(stringList.get(i));	
		}
		
	}
}
